const fs = require("node:fs");

module.exports = function (directory, ext, callback) {
  let arr = []
  fs.readdir(directory, (err, files) => {
    if (err) {
      return callback(err)
    }

    files.forEach((path) => {
      if (path.endsWith("." + ext)) {

        arr.push(path)

      }
    })

    callback(null, arr);

  })

};
